<!-- right-->

<div class="member-main">
  <div class="orderlist-warp">
    <div class="title"><{t}>我的订单<{/t}></div>
    <table class="gridlist shoping-cart-list" style="border-bottom:none" width="100%" border="0" cellspacing="0"  cellpadding="0">
      <col class="span-6">
        </col >

      <col class="span-1">
        </col >

      <col class="span-2">
        </col >

      <col class="span-1">
        </col >

      <col class="span-2" >
        </col >

      <col class="span-2">
        </col >

      <tr>
        <th class="first"><{t}>商品名称<{/t}></th>
        <th><{t}>订单号<{/t}></th>
        <th><{t}>下单日期<{/t}></th>
        <th><{t}>总金额<{/t}></th>
        <th><{t}>订单状态<{/t}></th>
        <th><{t}>操作<{/t}></th>
      </tr>
      <tbody>



      <{foreach from=$orders item="order" name=orders key="key"}>
        <tr
      <{if ($key+1)%2 == 0}>class="order-list-tr"<{/if}>>

        <td width="40%" class="horizontal-m">
        <{if $order.goods_items}>
          <{foreach from=$order.goods_items item=item_goods name=goods_item}>
          <div class="clearfix" <{if $item_goods.product}><{if count($order.goods_items)>1&&end($order.goods_items)!=$item_goods}>class="bottomboder clearfix"<{/if}>>

            <div class='product-list-img member-gift-pic goodpic' isrc="<{$item_goods.product.thumbnail_pic|default:$env.conf.site.default_thumbnail_pic|storager:'s'}>" ghref='<{link app=b2c ctl=site_product act="index" arg0=$item_goods.product.goods_id}>' > <img src='<{$res_url}>/loading.gif'/> </div>
          <div class="goods-main clearfix">
          <div style="width:46%;" class="goodinfo" >
          <h6><a target="_blank" class="font-blue" href="<{link app=b2c ctl="site_product" act="index" arg0=$item_goods.product.goods_id}>">
            <{$item_goods.product.name}> </a> </h6><{if $item_goods.product.attr}>
            <span class="font-gray"><{$item_goods.product.attr}></span> <{/if}>
            </div>
          <div class="member-gift-price price-wrap clearfix">
            <ul>
              <li class="price-normal"><{$item_goods.product.price|cur_odr:$order.currency}></li>
              <li>×<{$item_goods.product.quantity}></li>
            </ul>
            </div>
          </div>
          </div>
		  <{/if}>

          <!-- adjunct -->
          <{if $item_goods.adjunct_items}>
          <{foreach from=$item_goods.adjunct_items item=item_adjunct name=adjunct_item}>
          <div class="<{if $item_goods.product}>topborder <{/if}>clearfix ml20 pr">
              <span class="gift-f">赠</span>
              <div class='product-list-img member-gift-pic goodpic' isrc="<{$item_adjunct.thumbnail_pic|default:$env.conf.site.default_thumbnail_pic|storager:'s'}>" ghref='<{$item_adjunct.link_url}>' > <img src='<{$res_url}>/loading.gif'/> </div>
              <div class="goods-main clearfix">
            <div style="width:46%;" class="goodinfo" >
            <h6><a target="_blank" href="<{$item_adjunct.link_url}>"> <{$item_adjunct.name}> </a></h6>
            <{if $item_adjunct.attr}>
              <span><{$item_adjunct.attr}></span> <{/if}> </div>
            <div class="member-gift-price price-wrap clearfix">
              <ul>
                <li class="point"><{$item_adjunct.price|cur_odr:$order.currency}></li>
                <li>×<{$item_adjunct.quantity}></li>
              </ul>
            </div>
            </div>
          </div>
          <{/foreach}>
          <{/if}>
          <{if $item_goods.gift_items}>
          <{foreach from=$item_goods.gift_items item=item_gift name=gift_item}>
          <div class="<{if $item_goods.product}>topborder <{/if}>clearfix">

              <div class='product-list-img member-gift-pic goodpic' isrc="<{$item_gift.thumbnail_pic|default:$env.conf.site.default_thumbnail_pic|storager:'s'}>" ghref='<{$item_gift.link_url}>' > <img src='<{$res_url}>/loading.gif'/> </div>
            <div class="goods-main clearfix">
            <div style="width:46%" class="goodinfo">
            <h6><a target="_blank" href="<{$item_gift.link_url}>"> <{$item_gift.name}> </a></h6>
            <{if $item_gift.attr}>
              <span><{$item_gift.attr}></span> <{/if}> </div>
            <div class="member-gift-price pirce-wrap clearfix">
              <ul>
                <li class="point"><{$item_gift.price|cur_odr:$order.currency}></li>
                <li>×<{$item_gift.quantity}></li>
              </ul>
            </div>
            </div>
          </div>
          <{/foreach}>
          <{/if}>
		  <{/foreach}>
          <{/if}>
          <!-- gift -->
          <{if $order.gift_items}>
          <{foreach from=$order.gift_items item=item_gift name=gift_item}> <div <{if count($order.gift_items)>1&&end($order.gift_items)!=$item_gift}>class="bottomboder clearfix"<{/if}>>
		  <div class="topborder clearfix">
            <div class='product-list-img member-gift-pic goodpic' isrc="<{$item_gift.thumbnail_pic|default:$env.conf.site.default_thumbnail_pic|storager:'s'}>" ghref='<{$item_gift.link_url}>' > <img src='<{$res_url}>/loading.gif'/> </div>
                   <div class="goods-main clearfix">
                   <div style=" width:55%" class="goodinfo">
                   <h6><a target="_blank" href="<{$item_gift.link_url}>"> <{$item_gift.name}> </a></h6>
                   <{if $item_gift.attr}>
            <span><{$item_gift.attr}></span> <{/if}> </div>
          <div class="member-gift-price pirce-wrap clearfix">
            <ul>
              <li class="point"><{$item_gift.price|cur_odr:$order.currency}></li>
              <li>×<{$item_gift.quantity}></li>
            </ul>
            </div>
          </div>
          </div>
          <{/foreach}>
          <{/if}>

          <!-- extends -->
          <{if $order.extends_items}>
          <{foreach from=$order.extends_items item=item_extends name=item_extends}>
          <{$item_extends}>
          <{/foreach}>
          <{/if}> </td>
        <td class="vt" ><{$order.order_id}></td>
        <!--<td  class="textwrap"><{$order.tostr}></td> -->
        <td ><{$order.createtime|cdate:FDATE_STIME}></td>
        <td  class="point textcenter"><{$order.cur_amount|cur_odr:$order.currency:false:true}></td>
        <td class="textcenter"><span> <{if $order.status == 'finish'}><{t}>已完成<{/t}>
          <{elseif $order.status == 'dead'}><{t}>已作废<{/t}>
          <{else}>
          <{if $order.pay_status==1}><{t}>已付款<{/t}>
          [<{if $order.ship_status==1}>
          <{t}> 已发货<{/t}>
          <{elseif $order.ship_status==2}>
          <{t}>部分发货<{/t}>
          <{elseif $order.ship_status==3}>
          <{t}>部分退货<{/t}>
          <{elseif $order.ship_status==4}>
          <{t}>已退货<{/t}>
          <{else}>
          <{t}>正在备货...<{/t}>
          <{/if}>]
          <{elseif $order.pay_status==2}>
          <{t}>已付款至担保方<{/t}>
          <{elseif $order.pay_status==3}>
          <{t}>待补款<{/t}>
          <{if $order.ship_status==1}>
          <{t}>[已发货]<{/t}>
          <{elseif $order.ship_status==2}>
          <{t}> [部分发货]<{/t}>
          <{elseif $order.ship_status==3}>
          <{t}>[部分退货]<{/t}>
          <{elseif $order.ship_status==4}>
          <{t}>[已退货]<{/t}>
          <{/if}>
          <{elseif $order.pay_status==4}>
          <{t}> 部分退款<{/t}>
          [<{if $order.ship_status==1}>
          <{t}>已发货<{/t}>
          <{elseif $order.ship_status==2}>
          <{t}>部分发货<{/t}>
		  <{elseif $order.ship_status==3}>
			<{t}>部分退货<{/t}>
          <{elseif $order.ship_status==4}>
          <{t}>已退货<{/t}>
          <{elseif $order.ship_status==0}>
          <{t}>未发货<{/t}>
          <{/if}>]
          <{elseif $order.pay_status==5}>
          <{t}>已退款<{/t}>
          [<{if $order.ship_status==1}>
          <{t}>已发货<{/t}>
          <{elseif $order.ship_status==2}>
          <{t}>部分发货<{/t}>
		  <{elseif $order.ship_status==3}>
			<{t}>部分退货<{/t}>
          <{elseif $order.ship_status==4}>
          <{t}> 已退货<{/t}>
          <{elseif $order.ship_status==0}>
          <{t}>未发货<{/t}>
          <{/if}>]
          <{else}>
          <{t}>待付款<{/t}></a> <{if $order.ship_status==1}>
          <{t}>[已发货]<{/t}>
          <{elseif $order.ship_status==2}>
          <{t}>[部分发货]<{/t}>
          <{elseif $order.ship_status==3}>
          <{t}>[部分退货]<{/t}>
          <{elseif $order.ship_status==4}>
          <{t}>[已退货]<{/t}>
          <{/if}>
          <{/if}>
          <{/if}> </span></td>
        <td><{if $order.status == 'active' && ($order.pay_status=='0' || $order.pay_status=='3')}><{if $order.payinfo.pay_app_id != '-1'}><a href="<{link app=b2c ctl="site_member" act="orderPayments" arg0=$order.order_id}>" class="member-btn-bj operate-btn" ><{t}>去付款<{/t}></a>
          <{/if}><{/if}><a href="<{link app=b2c ctl="site_member" act="orderdetail" arg0=$order.order_id}>" class="member-btn-bj operate-btn"><{t}>查看订单<{/t}></a></td>
      </tr>
      <{/foreach}>
        </tbody>

    </table>
    <{pagers data=$pager}> </div>
</div>
<!-- right-->

<script>
/*小图mouseenter效果*/
window.addEvent('domready',function(){

  var cart_product_img_viewer=new Element('div',{styles:{'position':'absolute','zIndex':500,'opacity':0,'border':'1px #666 solid'}}).inject(document.body);

  var cpiv_show=function(img,event){

      if(!img)return;
      cart_product_img_viewer.empty().adopt($(img).clone().removeProperties('width','height').setStyle('border','1px #fff solid')).fade(1);

      var size = window.getSize(), scroll = window.getScroll();
        var tip = {x: cart_product_img_viewer.offsetWidth, y: cart_product_img_viewer.offsetHeight};
        var props = {x: 'left', y: 'top'};
        for (var z in props){
            var pos = event.page[z] + 10;
            if ((pos + tip[z] - scroll[z]) > size[z]) pos = event.page[z] - 10 - tip[z];
            cart_product_img_viewer.setStyle(props[z], pos);
        }

  };

   $$('.gridlist .product-list-img').each(function(i){

       new Asset.image(i.get('isrc'),{onload:function(img){
	   if(!img)return;
           var _img=img.zoomImg(50,50);
		     if(!_img)return;
           _img.setStyle('cursor','pointer').addEvents({
              'mouseenter':function(e){
                 cpiv_show(_img,e);
              },
              'mouseleave':function(e){
                cart_product_img_viewer.fade(0);
              }
           });
           i.empty().adopt(new Element('a',{href:i.get('ghref'),target:'_blank',styles:{border:0}}).adopt(_img));
       },onerror:function(){
            i.empty();

       }});

   });

});
</script>
